#pragma once
#include "User.h"
#include "Table.h"
#include <string>
#include <map>

using std::map;

class User;

typedef map<int, User*> UserMap;
typedef map<int, Table> TableMap;

class GameServer : public netEvent, public timeEvent
{
public:
	GameServer();
	~GameServer();
	int initServer(int port);
	int initTables();
public://net recall
	
	virtual int handleOpen();
	virtual int handleClose( );
	virtual int handleRead(char *buf, unsigned int size, void *args);
	virtual int handleWrite();

	virtual int handleTimeout(int id);
public:
	void __printTablesInfo__();
public://tools
	Table* getTablePtr(int);

public:
	UserMap serverUsers;
	TableMap serverTables;

	ConnInfo listener;
	TimerInfo timer;
				
	
};
